#include"../Client/Rpc_client.hpp"

// using Callback = std::function<void(const std::string &key, const std::string &msg)>; // 针对订阅的主题的回调函数

void callback(const std::string &key, const std::string &msg)
{
    cout << "收到订阅主题的消息:" << key << " " << msg << endl;
}

int main()
{
    //实例化订阅端
    zgwrpc::client::Topic_client client("127.0.0.1",7070);


    //创建主题
    client.Create("原神");

    //  订阅主题
    client.Subscribe("原神", callback);
    //等待接收

    std::this_thread::sleep_for(std::chrono::seconds(10));
    client.Shutdown();

    return 0;
}